//
//  GetRefundVM.swift
//  Pods
//
//  Created by eme on 2017/4/25.
//
//

import UIKit
import RxSwift
import SwiftyJSON
import ModelProtocol
import UtilCore

class GetRefundVM:Base_Vm{
    
    let request = PublishSubject<String>()
    let backDate = PublishSubject<RefundModel>()

    
    
    override init(){
        
        super.init()
        
        let request = self.request.map{ id in
            
            return MineApi.getTKDetaile(detailid: id)
            
            }.shareReplay(1)
        
        let response = request.emeRequestApiForObj(RefundModel.self)
        
        
        response.asObservable().subscribe(onNext:{ event in
            switch event{
            case .success(let data):
                
                self.backDate.onNext(data)
                
            case .failure(let error):
                
                self.error.onNext(error)
            }
            
        }).addDisposableTo(disposeBag)
        
    }
    
    
}
